package cn.itcast.controller;

import cn.itcast.constant.MessageConstant;
import cn.itcast.entity.Result;
import cn.itcast.pojo.Address;
import cn.itcast.service.AddressService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("address")
/**
 * 分院信息
 */
public class AddressController {
    @Reference
    private AddressService addressService;
    @GetMapping("findAll")
    public Result findAll(){
        List<Address> addressList = addressService.findAll();

        if (null == addressList) {
            return new Result(false, MessageConstant.QUERY_ADDRESS_FAIL);
        }

        return new Result(true,MessageConstant.QUERY_ADDRESS_SUCCESS,addressList);
    }
}
